<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>GL.Buffer</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: </em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/BBox.html">BBox</a></li>
                                <li><a href="../classes/geo.html">geo</a></li>
                                <li><a href="../classes/GL.html">GL</a></li>
                                <li><a href="../classes/gl.html">gl</a></li>
                                <li><a href="../classes/GL.Buffer.html">GL.Buffer</a></li>
                                <li><a href="../classes/GL.FBO.html">GL.FBO</a></li>
                                <li><a href="../classes/GL.Indexer.html">GL.Indexer</a></li>
                                <li><a href="../classes/GL.Mesh.html">GL.Mesh</a></li>
                                <li><a href="../classes/GL.Octree.html">GL.Octree</a></li>
                                <li><a href="../classes/GL.Shader.html">GL.Shader</a></li>
                                <li><a href="../classes/GL.Texture.html">GL.Texture</a></li>
                                <li><a href="../classes/LEvent.html">LEvent</a></li>
                            </ul>
                
                
                            <ul id="api-modules" class="apis modules">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>GL.Buffer Class</h1>
<div class="box meta">


        <div class="foundat">
            Defined in: <a href="../files/.._src_mesh.js.html#l26"><code>..&#x2F;src&#x2F;mesh.js:26</code></a>
        </div>


</div>


<div class="box intro">
    <p>A data buffer to be stored in the GPU</p>

</div>

    <div class="constructor">
        <h2>Constructor</h2>
<div id="method_GL.Buffer" class="method item">
    <h3 class="name"><code>GL.Buffer</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>target</code>
                </li>
                <li class="arg">
                        <code>data</code>
                </li>
                <li class="arg">
                        <code>spacing</code>
                </li>
                <li class="arg">
                        <code>stream_type</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l26"><code>..&#x2F;src&#x2F;mesh.js:26</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">target</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>gl.ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">data</code>
                        <span class="type">ArrayBufferView</span>


                    <div class="param-description">
                        <p>the data in typed-array format</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">spacing</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>number of numbers per component (3 per vertex, 2 per uvs...), default 3</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">stream_type</code>
                        <span class="type">Enum</span>


                    <div class="param-description">
                        <p>default gl.STATIC_DRAW (other: gl.DYNAMIC_DRAW, gl.STREAM_DRAW</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
    </div>

<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                            <li class="index-item method">
                                <a href="#method_applyTransform">applyTransform</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_clone">clone</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_delete">delete</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_forEach">forEach</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_setData">setData</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_upload">upload</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_uploadRange">uploadRange</a>

                            </li>
                    </ul>
                </div>



        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method_applyTransform" class="method item">
    <h3 class="name"><code>applyTransform</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>mat</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l70"><code>..&#x2F;src&#x2F;mesh.js:70</code></a>
        </p>



    </div>

    <div class="description">
        <p>Applies a mat4 transform to every triplets in the buffer (assuming they are points)
No upload is performed (to ensure efficiency in case there are several operations performed)</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">mat</code>
                        <span class="type">Mat4</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_clone" class="method item">
    <h3 class="name"><code>clone</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>share</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l204"><code>..&#x2F;src&#x2F;mesh.js:204</code></a>
        </p>



    </div>

    <div class="description">
        <p>Clones one buffer (it allows to share the same data between both buffers)</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">share</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>if you want that both buffers share the same data (default false)
return {GL.Buffer} buffer cloned</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_delete" class="method item">
    <h3 class="name"><code>delete</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l263"><code>..&#x2F;src&#x2F;mesh.js:263</code></a>
        </p>



    </div>

    <div class="description">
        <p>Deletes the content from the GPU and destroys the handler</p>

    </div>




</div>
<div id="method_forEach" class="method item">
    <h3 class="name"><code>forEach</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>callback</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l55"><code>..&#x2F;src&#x2F;mesh.js:55</code></a>
        </p>



    </div>

    <div class="description">
        <p>Applies an action to every vertex in this buffer</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">callback</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>to be called for every vertex (or whatever is contained in the buffer)</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_setData" class="method item">
    <h3 class="name"><code>setData</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>data</code>
                </li>
                <li class="arg">
                        <code>offset</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l141"><code>..&#x2F;src&#x2F;mesh.js:141</code></a>
        </p>



    </div>

    <div class="description">
        <p>Assign data to buffer and uploads it (it allows range)</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">data</code>
                        <span class="type">ArrayBufferView</span>


                    <div class="param-description">
                        <p>in Float32Array format usually</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">offset</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>offset in bytes</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_upload" class="method item">
    <h3 class="name"><code>upload</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>stream_type</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l87"><code>..&#x2F;src&#x2F;mesh.js:87</code></a>
        </p>



    </div>

    <div class="description">
        <p>Uploads the buffer data (stored in this.data) to the GPU</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">stream_type</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>default gl.STATIC_DRAW (other: gl.DYNAMIC_DRAW, gl.STREAM_DRAW</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_uploadRange" class="method item">
    <h3 class="name"><code>uploadRange</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>start</code>
                </li>
                <li class="arg">
                        <code>size</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_mesh.js.html#l181"><code>..&#x2F;src&#x2F;mesh.js:181</code></a>
        </p>



    </div>

    <div class="description">
        <p>Uploads part of the buffer data (stored in this.data) to the GPU</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">start</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>offset in bytes</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">size</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>sizes in bytes</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
            </div>



    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
